package com.itheima.dao;

import com.itheima.pojo.Menu;

import java.util.List;

/**
 * @author wgq
 * @date 2019-10-19 22:56
 * 动态菜单--> 持久层
 */
public interface MenuDao {
    /**
     * 动态菜单的查询
     * @return
     */
    /*-- 根据登录名 查询用户ID
    SELECT id FROM t_user WHERE username = 'xiaoming'
            -- 根据用户ID查看对应的角色 role_id
    SELECT role_id FROM `t_user_role` WHERE user_id = (SELECT id FROM t_user WHERE username = 'xiaoming')
            -- 根据role_iD 去查看menu_id
    SELECT menu_id FROM `t_role_menu` WHERE role_id IN (SELECT role_id FROM `t_user_role` WHERE user_id = (SELECT id FROM t_user WHERE username = 'xiaoming')
)
        -- 根据menu_id 查看menu详情
    SELECT * FROM `t_menu` WHERE id IN
            (SELECT menu_id FROM `t_role_menu` WHERE role_id IN
                    (SELECT role_id FROM `t_user_role` WHERE user_id =
                    (SELECT id FROM t_user WHERE username = 'xiaoming')))*/
    List<Menu> findMenuList(String username);
}
